/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entitesDB;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author CDI104
 */
@Entity
@Table(name = "REVUE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Revue.findAll", query = "SELECT r FROM Revue r"),
    @NamedQuery(name = "Revue.findByIdRevue", query = "SELECT r FROM Revue r WHERE r.idRevue = :idRevue"),
    @NamedQuery(name = "Revue.findByIndice", query = "SELECT r FROM Revue r WHERE r.indice = :indice"),
    @NamedQuery(name = "Revue.findByNomrevue", query = "SELECT r FROM Revue r WHERE r.nomrevue = :nomrevue"),
    @NamedQuery(name = "Revue.findByPeriodicite", query = "SELECT r FROM Revue r WHERE r.periodicite = :periodicite"),
    @NamedQuery(name = "Revue.findByPrixventece", query = "SELECT r FROM Revue r WHERE r.prixventece = :prixventece"),
    @NamedQuery(name = "Revue.findByPrixventepublic", query = "SELECT r FROM Revue r WHERE r.prixventepublic = :prixventepublic")})
public class Revue implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idRevue")
    private BigDecimal idRevue;
    @Column(name = "INDICE")
    private Integer indice;
    @Size(max = 255)
    @Column(name = "NOMREVUE")
    private String nomrevue;
    @Size(max = 255)
    @Column(name = "PERIODICITE")
    private String periodicite;
    @Column(name = "PRIXVENTECE")
    private Float prixventece;
    @Column(name = "PRIXVENTEPUBLIC")
    private Float prixventepublic;
    @ManyToMany(mappedBy = "revueCollection")
    private Collection<Package> packageCollection;
    @JoinColumn(name = "EDITEURS_idEditeur", referencedColumnName = "idEditeur")
    @ManyToOne
    private Editeur eDITEURSidEditeur;

    public Revue() {
    }

    public Revue(BigDecimal idRevue) {
        this.idRevue = idRevue;
    }

    public BigDecimal getIdRevue() {
        return idRevue;
    }

    public void setIdRevue(BigDecimal idRevue) {
        this.idRevue = idRevue;
    }

    public Integer getIndice() {
        return indice;
    }

    public void setIndice(Integer indice) {
        this.indice = indice;
    }

    public String getNomrevue() {
        return nomrevue;
    }

    public void setNomrevue(String nomrevue) {
        this.nomrevue = nomrevue;
    }

    public String getPeriodicite() {
        return periodicite;
    }

    public void setPeriodicite(String periodicite) {
        this.periodicite = periodicite;
    }

    public Float getPrixventece() {
        return prixventece;
    }

    public void setPrixventece(Float prixventece) {
        this.prixventece = prixventece;
    }

    public Float getPrixventepublic() {
        return prixventepublic;
    }

    public void setPrixventepublic(Float prixventepublic) {
        this.prixventepublic = prixventepublic;
    }

    @XmlTransient
    public Collection<Package> getPackageCollection() {
        return packageCollection;
    }

    public void setPackageCollection(Collection<Package> packageCollection) {
        this.packageCollection = packageCollection;
    }

    public Editeur getEDITEURSidEditeur() {
        return eDITEURSidEditeur;
    }

    public void setEDITEURSidEditeur(Editeur eDITEURSidEditeur) {
        this.eDITEURSidEditeur = eDITEURSidEditeur;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRevue != null ? idRevue.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Revue)) {
            return false;
        }
        Revue other = (Revue) object;
        if ((this.idRevue == null && other.idRevue != null) || (this.idRevue != null && !this.idRevue.equals(other.idRevue))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitesDB.Revue[ idRevue=" + idRevue + " ]";
    }
    
}
